package com.sg.business.commons;

import com.mobnut.portal.IDirectLinkHandler;
import com.mongodb.DBObject;

public class DocumentsDirectLinkHandler implements IDirectLinkHandler {

	public DocumentsDirectLinkHandler() {
	}

	@Override
	public boolean accept(DBObject uclData) {
		Object appdata = uclData.get("appdata");
		if(appdata instanceof DBObject){
			String api = (String) ((DBObject) appdata).get("api");
			return "documentsQuery".equalsIgnoreCase(api);
		}
		return false;
	}

	@Override
	public String getPerspective() {
		return "perspective.documentviewer2";
	}

	@Override
	public DBObject getAppData(DBObject uclData) {
		Object appdata = uclData.get("appdata");
		if(appdata instanceof DBObject){
			return (DBObject) appdata;
		}
		return null;
	}

}
